#ifndef GAMEOFLIFE_GLOBALS
#define GAMEOFLIFE_GLOBALS

#include <cstdlib>
#include <iostream>
#include <mpi.h>
#include <pthread.h>
#include <time.h>
#include <fstream>
#include <Windows.h>
#include <math.h>
#include <omp.h>
#include "SimpleMatrix.h"


#define ROWS				25000
#define COLUMNS				10000
#define TICK_COUNT			4
#define DEAD_PROB			50
#define MAX_MEMORY_USAGE	268435456 //bytes
//#define MPI_DEBUG
#define DEBUG_SEED
//#define PTHREAD_DEBUG
//#define GENERAL_DEBUG
#define MAX_THREAD			4

//MPI message codes
#define MSG_COLUMN			0x00
#define MSG_ROW				0x01
#define MSG_TOTAL_ROWS		0x02
#define MSG_TOTAL_COLUMNS	0x03
#define MSG_ALLOC_ROWS		0x04

extern int processes; //number of processes
extern int myrank; //process rank
extern int *elements; //vector containg the number of rows received from the master by the i-th process
extern int maxElem; //max elements given to each process
extern int rows; //rows of the matrix synched with the master process
extern int columns; //columns of the matrix synched with the master process
extern pthread_t* p_threads; //array of pthread ids
extern int thread_amount; //number of threads
extern MEMORYSTATUSEX statex; //struct for memory info

extern SimpleMatrix<unsigned char> *currentUniverse;
extern SimpleMatrix<unsigned char> *nextUniverse;
extern SimpleMatrix<unsigned char> *globalUniverse;

extern enum spawnConfig; //options for the initial seed
extern enum hpcOption; //options for hpc computing
extern enum threadOption; //options for thread generation
extern enum allocationOption; //option for manage memory allocation

extern struct ReportData; //data for the final report file

#endif